package com.fastCms.manager.bim.controller.api;

import com.fastCms.business.bim.manage.ProdDeviceService;
import com.fastCms.business.bim.pojo.entity.DataProd;
import com.fastCms.business.bim.pojo.po.ProdChartPO;
import com.fastCms.business.bim.pojo.po.ProdPO;
import com.fastCms.business.bim.pojo.vo.CcqDeviceVO;
import com.fastCms.business.bim.pojo.vo.DataProdVO;
import com.fastCms.business.frame.pojo.PageParam;
import com.fastCms.business.frame.response.ApiResponse;
import com.fastCms.business.frame.response.ResponseUtil;
import com.fastCms.manager.frame.annotation.UserAccess;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: RogersZheng
 * @Date: 2021/6/24 1:47 下午
 * @Description: com.fastCms.customer.work.controller.admin
 */
@RestController
@RequestMapping("api/prod")
@Api(value = "ProdController", tags = "前端-生产设备相关")
@UserAccess
public class ApiProdController {

    @Autowired
    private ProdDeviceService prodDeviceServiceImpl;

    @ApiOperation(value = "生产设备运行台账", notes = "")
    @PostMapping("/prodDevice")
    public ApiResponse<PageInfo<DataProdVO>> getDeviceData(@RequestBody PageParam<ProdPO> pageParam) {
        PageInfo<DataProdVO> result = prodDeviceServiceImpl.getData(pageParam);
        return ResponseUtil.success(result);
    }


    @ApiOperation(value = "除尘器设备列表", notes = "")
    @PostMapping("/prodCCQDevice")
    public ApiResponse<PageInfo<CcqDeviceVO>> prodCCQDevice(@RequestBody PageParam<ProdPO> pageParam) {
        ProdPO prodPO = pageParam.getQueryFields();
        prodPO.setName("除尘");
        pageParam.setQueryFields(prodPO);
        PageInfo<CcqDeviceVO> result = prodDeviceServiceImpl.getCcqData(pageParam);
        return ResponseUtil.success(result);
    }


    @ApiOperation(value = "生成设备数据曲线", notes = "")
    @PostMapping("/getDeviceData")
    public ApiResponse<List<DataProd>> getDeviceData(@RequestBody ProdChartPO param) {
        List<DataProd> result = prodDeviceServiceImpl.getDeviceData(param);
        return ResponseUtil.success(result);
    }
}




